CREATE TABLE DAC_ISSUE
(
  ISSUE_ID    NUMBER(10)   NOT NULL,
  ISSUE_TITLE    VARCHAR2(255)   NOT NULL,
  ISSUE_DESC    VARCHAR2(2000)   NULL,
  ISSUE_STS    NUMBER(10)   NOT NULL,
  ISSUE_TYP    VARCHAR2(50)   NULL,
  ISSUE_OWNR    VARCHAR2(50)   NULL,
  ISSUE_PRGS    NUMBER(18, 2)   NULL,
  CREATE_TM    DATE   NOT NULL,
  ISSUE_LOCKED    NUMBER(10)   NULL,
    CONSTRAINT PK_DAC_ISSUE PRIMARY KEY (ISSUE_ID)
)
/

CREATE SEQUENCE DAC_ISSUE_ISSUE_ID_SEQ
START WITH 1
INCREMENT BY 1
/

CREATE OR REPLACE TRIGGER DAC_ISSUE_ISSUE_ID_TRIGGER
  BEFORE INSERT
  ON DAC_ISSUE
  REFERENCING OLD AS OLD NEW AS NEW
  FOR EACH ROW   
BEGIN   
  SELECT DAC_ISSUE_ISSUE_ID_SEQ.NEXTVAL INTO :NEW.ISSUE_ID FROM DUAL;
END;
/

CREATE TABLE DAC_USER
(
  USER_ID    VARCHAR2(50)   NOT NULL,
  USERNAME    VARCHAR2(50)   NOT NULL,
  FULLNAME    VARCHAR2(255)   NULL,
  USER_PWD    VARCHAR2(50)   NULL,
  CHANGINGPWD    NUMBER(10)   NULL,
  USERLOCKED    NUMBER(10)   NULL,
  LASTLOGIN    DATE   NULL,
  USER_DESC    VARCHAR2(2000)   NULL,
    CONSTRAINT PK_DAC_USER PRIMARY KEY (USER_ID)
)
/

CREATE TABLE DAC_LINE
(
  POINT_ID    NUMBER(10)   NOT NULL,
  POINT    VARCHAR2(50)   NULL,
    CONSTRAINT PK_DAC_LINE PRIMARY KEY (POINT_ID)
)
/

CREATE SEQUENCE DAC_LINE_POINT_ID_SEQ
START WITH 1
INCREMENT BY 1
/

CREATE OR REPLACE TRIGGER DAC_LINE_POINT_ID_TRIGGER
  BEFORE INSERT
  ON DAC_LINE
  REFERENCING OLD AS OLD NEW AS NEW
  FOR EACH ROW   
BEGIN   
  SELECT DAC_LINE_POINT_ID_SEQ.NEXTVAL INTO :NEW.POINT_ID FROM DUAL;
END;
/

CREATE TABLE DAC_MUTIPLEKEYS
(
  DAC_KEY1    VARCHAR2(50)   NOT NULL,
  DAC_KEY2    VARCHAR2(50)   NOT NULL,
  DAC_VALUE1    VARCHAR2(50)   NULL,
  DAC_VALUE2    VARCHAR2(50)   NULL,
    CONSTRAINT PK_DAC_MUTIPLEKEYS PRIMARY KEY (DAC_KEY1, DAC_KEY2)
)
/

